package com.xbb.mapper;

import com.xbb.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Mr xie
 * @since 2020-06-15
 */
public interface MessageMapper extends BaseMapper<Message> {
    @Select("select message.*,users.*,student.* from message,users,student " +
            "where stu_id=student.id " +
            "and users.id=accept_id" +
            "and accept_id=#{id} and is_open='未打开' " +
            "order by create_time " +
            "limit 1")
   public Message getMessage(Integer id);


    @Select("select message.*,users.*,student.* from message,users,student " +
            "where stu_id=student.id " +
            "and users.id=accept_id " +
            "and accept_id=#{id} order by message.create_time desc ")
    public List<Message> getMessages(Integer id);


    public boolean updateBatchMessage(Integer uid);
}
